#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2023/12/3 14:41
# @Author  : 新猿异码
# @Site    : https://gitee.com/chshao/autotest
# @CSDN    : https://blog.csdn.net/m0_37576542?type=blog
# @File    : Assert.py
# @Desc    : 自定义断言库组件
# @Software: PyCharm
class AssertError(Exception):

    def __init__(self, error):
        super(AssertError, self).__init__()
        self.errorMsg = error

    def __str__(self):
        return self.errorMsg


def AssertTrue(ret):
    if ret is False:
        raise AssertError("expect true,but false.")
    return ret


def AssertFalse(ret):
    if ret is True:
        raise AssertError("expect false,but true.")
    return ret


def AssertEqual(ret1, ret2):
    if ret1 != ret2:
        raise AssertError("the elements not equal, but you expect equal.")
    return True


def AssertNotEqual(ret1, ret2):
    if ret1 == ret2:
        raise AssertError("the elements are equal, but you expect not equal.")
    return True


def AssertNone(ret):
    if ret is not None:
        raise AssertError("expect None,but not None.")
    return True


def AssertNotNone(ret):
    if ret is None:
        raise AssertError("expect not None,but None.")
    return True



